package com.ztc.ZtcRoutePrice.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ztc.ZtcRoutePrice.bean.ZtcRoutePrice;
import com.ztc.ZtcRoutePrice.service.ZtcRoutePriceManager;
import java.util.HashMap;
import java.util.List;
@Controller
@RequestMapping("ztc_price_action")
public class ZtcRoutePriceAction {
	@Autowired
	private ZtcRoutePriceManager ztcRoutePriceManager;

	@RequestMapping("init")
	@ResponseBody
	/**
	 * 展示所有线路价格
	 * 
	 * @return  线路价格集合
	 */
	public HashMap<String, Object> getAll() {
		List<ZtcRoutePrice> list = ztcRoutePriceManager.getAll();
		HashMap<String, Object> wapper = new HashMap<>();
		wapper.put("success", Boolean.valueOf(true));
		wapper.put("data", list);
		return wapper;
	}

	/**
	 * 根据起始站名称和结束站点名称模糊查询线路价格信息
	 * @param routeStartSiteName 起始站点名称
	 * @param routeEndSiteName 结束站点名称
	 * @return 线路价格信息集合
	 */
	@RequestMapping("searchInfoLikes")
	@ResponseBody
	public HashMap<String, Object> searchInfoLikes(String routeStartSiteName,String routeEndSiteName) {
		List<ZtcRoutePrice> list = ztcRoutePriceManager.searchInfoLikes(routeStartSiteName,routeEndSiteName);
		HashMap<String, Object> wapper = new HashMap<>();
		wapper.put("success", Boolean.valueOf(true));
		wapper.put("data", list);
		return wapper;
	}
}